import React from 'react';
import {useNavigate} from "react-router-dom";

function Index(props) {
    const navigate = useNavigate()
    const logout = function (){
        localStorage.clear()
        navigate('/login')
    }
    return (
        <div>
            <h3>个人中心</h3>
            <h2>欢迎{localStorage.getItem('userName')}登录！</h2>
            <button onClick={logout}>退出登录</button>
        </div>
    );
}

export default Index;